import java.util.Arrays;
import java.util.Scanner;

public class Test12 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long m = in.nextInt();

        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = in.nextInt();
        }

        long[] grow = new long[n];
        for (int i = 0; i < n; i++) {
            grow[i] = (long)a[i] * b[i];
        }
        Arrays.sort(grow);
        long total = 0;
        int days = 0;
        for (int i = n - 1; i >= 0 ; i--) {
            total += grow[i];
            days++;
            if(total >= m){
                System.out.println(days);
                return;
            }
        }
        System.out.println(-1);
    }
}
